This package implements various tests, visualizations, and metrics for use with environmental niche models (ENMs) and species distribution models (SDMs).
At present, ENMTools is downloadable from https://github.com/danlwarren/ENMTools. There are multiple ways to download it. The easiest is to use devtools and install from GitHub.
Run the following code from your R console:
install.packages("devtools")
library(devtools)
install_github("danlwarren/ENMTools")
library(ENMTools)
A zipped version of the package is available at https://github.com/danlwarren/ENMTools/archive/master.zip. To install from the zip file, download a copy of it to your system. Once it’s finished downloading, type the following (where PATH is the path to the zip file):
install.packages("devtools")
library(devtools)
install_local("PATH")
library(ENMTools)
First we’re going to load in some environmental data.
env.files <- list.files(path = "test/testdata/", pattern = "pc", full.names = TRUE)
env <- stack(env.files)
names(env) <- c("layer.1", "layer.2", "layer.3", "layer.4")
env <- setMinMax(env)
ENMTools is primarily designed to examine patterns of similarity and difference between ENMs for different species. In order to simplify interactions with the functions in ENMTools, you need to put your data for each of your species into an enmtools.species object. You can create and view an empty enmtools.species object just by typing:
ahli <- enmtools.species()
ahli
##
##
## Range raster not defined.
##
## Presence points not defined.
##
## Background points not defined.
##
## Species name not defined.
You can add data to this object manually:
names(ahli)
## [1] "range" "presence.points" "background.points"
## [4] "models" "species.name"
ahli$species.name <- "ahli"
ahli$presence.points <- read.csv("test/testdata/ahli.csv")[,3:4]
ahli$range <- background.raster.buffer(ahli$presence.points, 50000, mask = env)
ahli$background.points <- background.points.buffer(points = ahli$presence.points,
radius = 20000, n = 1000, mask = env[[1]])
ahli
##
##
## Range raster:
## class : RasterLayer
## dimensions : 418, 1535, 641630 (nrow, ncol, ncell)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -86.90809, -74.11642, 19.80837, 23.2917 (xmin, xmax, ymin, ymax)
## coord. ref. : NA
## data source : in memory
## names : layer.1
## values : 1, 1 (min, max)
##
##
##
## Presence points (first ten only):
##
## Longitude Latitude
## ---------- ---------
## -80.0106 21.8744
## -79.9086 21.8095
## -79.8065 21.7631
## -79.8251 21.8095
## -79.8807 21.8374
## -79.9550 21.8374
## -80.3446 22.0136
## -80.2983 21.9951
## -80.1776 21.9023
## -80.1591 21.9673
##
##
## Background points (first ten only):
##
## Longitude Latitude
## ---------- ---------
## -80.12059 21.96254
## -79.94559 21.82087
## -80.20392 21.94587
## -80.37059 22.11254
## -79.85392 21.98754
## -79.74559 21.93754
## -79.93726 21.78754
## -79.85392 21.96254
## -80.05392 22.00420
## -79.97059 22.13754
##
##
## Species name: ahli
Or you can add bits of it when the object is created:
allogus <- enmtools.species(species.name = "allogus",
presence.points = read.csv("test/testdata/allogus.csv")[,3:4])
allogus$range <- background.raster.buffer(allogus$presence.points, 50000, mask = env)
allogus$background.points <- background.points.buffer(points = allogus$presence.points,
radius = 20000, n = 1000, mask = env[[1]])
allogus
##
##
## Range raster:
## class : RasterLayer
## dimensions : 418, 1535, 641630 (nrow, ncol, ncell)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -86.90809, -74.11642, 19.80837, 23.2917 (xmin, xmax, ymin, ymax)
## coord. ref. : NA
## data source : in memory
## names : layer.1
## values : 1, 1 (min, max)
##
##
##
## Presence points (first ten only):
##
## Longitude Latitude
## ---------- ---------
## -79.2527 22.2109
## -78.7774 22.2241
## -78.6189 22.2373
## -78.1039 21.1809
## -78.0247 21.1809
## -77.9983 20.9301
## -77.9719 21.7091
## -77.9719 21.5507
## -77.9323 21.6167
## -77.9323 20.7320
##
##
## Background points (first ten only):
##
## Longitude Latitude
## ---------- ---------
## -77.34559 20.09587
## -76.43726 20.10420
## -75.05392 20.63754
## -76.75392 19.96254
## -75.09559 20.15420
## -77.35392 20.99587
## -78.02892 21.52920
## -76.60392 20.24587
## -77.17892 20.06254
## -76.28726 20.11254
##
##
## Species name: allogus
ENMTools contains functions to simplify the ENM construction process. Using enmtools.species objects and the correct modeling commands, we can build models very quickly. These commands are primarily wrappers to dismo model construction and projection functions, and at present are only available for GLM, Maxent, Domain, and Bioclim models. One of the nice bits about this setup is that it allows enmtools to automatically generate suitability maps, do model evaluation, and plot the marginal suitability of habitat for each variable separately.
GLMs require the user to supply a formula, an enmtools.species object, and some environmental data.
ahli.glm <- enmtools.glm(f = pres ~ layer.1 + layer.2 + layer.3 + layer.4, species = ahli, env = env, test.prop = 0.2)
## Adding environmental data to species ahli
## Processing presence points...
## Processing background points...
allogus.glm <- enmtools.glm(pres ~ layer.1 + layer.2 + layer.3 + layer.4, allogus, env, test.prop = 0.2)
## Adding environmental data to species allogus
## Processing presence points...
## Processing background points...
ahli.glm
##
##
## Formula: presence ~ layer.1 + layer.2 + layer.3 + layer.4
## <environment: 0x7f9feb19c4e0>
##
##
## Data table (top ten lines):
##
## Longitude Latitude layer.1 layer.2 layer.3 layer.4 presence
## --- ---------- --------- -------- -------- -------- -------- ---------
## 1 -80.0106 21.8744 2765 1235 1174 252 1
## 4 -79.8251 21.8095 2207 1877 967 259 1
## 5 -79.8807 21.8374 2244 1828 945 249 1
## 6 -79.9550 21.8374 2250 1766 919 235 1
## 7 -80.3446 22.0136 2201 1822 978 277 1
## 9 -80.1776 21.9023 2287 1722 992 266 1
## 10 -80.1591 21.9673 2984 965 1311 237 1
## 11 -80.1498 21.9858 3042 841 1371 221 1
## 12 -80.1220 21.9301 2898 1033 1231 242 1
## 13 -80.1776 21.9673 2914 1020 1256 237 1
##
##
## Model:
## Call:
## glm(formula = f, family = "binomial", data = analysis.df[, -c(1,
## 2)])
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.6925 -0.1690 -0.1161 -0.0814 3.1967
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 41.569658 28.389974 1.464 0.143
## layer.1 -0.011501 0.007203 -1.597 0.110
## layer.2 -0.010504 0.007563 -1.389 0.165
## layer.3 0.003330 0.007575 0.440 0.660
## layer.4 -0.018507 0.025906 -0.714 0.475
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 130.29 on 1011 degrees of freedom
## Residual deviance: 117.26 on 1007 degrees of freedom
## AIC: 127.26
##
## Number of Fisher Scoring iterations: 8
##
##
##
## Model fit (training data): class : ModelEvaluation
## n presences : 12
## n absences : 1000
## AUC : 0.769625
## cor : 0.1126523
## max TPR+TNR at : -5.10352
##
##
## Proportion of data wittheld for model fitting: 0.2
##
## Model fit (test data): class : ModelEvaluation
## n presences : 4
## n absences : 1000
## AUC : 0.7265
## cor : 0.04034204
## max TPR+TNR at : -4.627523
##
##
## Suitability:
## class : RasterLayer
## dimensions : 418, 1535, 641630 (nrow, ncol, ncell)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -86.90809, -74.11642, 19.80837, 23.2917 (xmin, xmax, ymin, ymax)
## coord. ref. : NA
## data source : in memory
## names : layer
## values : 1.038365e-10, 0.9999581 (min, max)
To check out the marginal response functions, you only need to type
ahli.glm$response.plots
## $layer.1
##
## $layer.2
##
## $layer.3
##
## $layer.4
The procedure for building Bioclim, Domain, and Maxent models is similar to the procedure for GLMs, with the exception that you do not need to pass a formula to the model function. Note that running Maxent models requires a bit of extra setup; see dismo documentation for details.
ahli.dm <- enmtools.dm(ahli, env, test.prop = 0.2)
ahli.bc <- enmtools.bc(ahli, env, test.prop = 0.2)
ahli.mx <- enmtools.maxent(ahli, env, test.prop = 0.2)
ENMTools provides a number of metrics for ENMs and for similarities between ENMs. These include measures of niche breadth, based on Levins(1968). An important caveat when interpreting these metrics is that they are driven to some (variable) extent by the availability of different combinations of environmental variables. As such they are more accurately interpreted as a measurment of the smoothness of the geographic distribution of suitability scores than as an estimate of the breadth of the fundamental niche; an orgamism with narrow fundamental niche breadth that nonetheless encompasses a set of environmental conditions that is quite common will have a high breadth when measured using ENMs, while having a low breadth in environment space.
raster.breadth(ahli.glm)
## $B1
## [1] 0.1396188
##
## $B2
## [1] 0.8575731
ENMTools also provides metrics for measuring similarity between ENMs. These include Schoener’s D (Schoener 1968), I (Warren et al. 2008), and the Spearman rank correlation coefficient between two rasters. While D and I are commonly used in the ENM literature, they may tend to overestimate similarity between ENMs when many grid cells are of similar values (e.g., when two species prefer different habitat but the region contains a great deal of habitat that is unsuitable for both).
raster.overlap(ahli.glm, allogus.glm)
## $D
## [1] 0.3426922
##
## $I
## [1] 0.62796
##
## $rank.cor
## [1] 0.7466339
A new feature of the R version of ENMTools is that you can now use these same metrics in the n-dimensional space of all combinations of environmental variables, instead of restricting your measures of model similarity to those sets of conditions that appear in the training region. This is done by repeatedly drawing Latin hypercube samples from the space of all possible combinations of environmental variables given the min and max of each variable within the training region. ENMTools continues to draw samples until subsequent iterations differ by less than a specified tolerance value. Lower tolerance values result in more precise estimates of overlap, but can take much longer to calculate.
env.overlap(ahli.glm, allogus.glm, env, tolerance = .001)
## $env.D
## [1] 0.501037
##
## $env.I
## [1] 0.7182709
##
## $env.cor
## [1] 0.4948059
In this example, we will run a niche identity (also called equivalency) test, as in Warren et al. 2008. This test takes the presence points for a pair of species and randomly reassigns them to each species, then builds ENMs for these randomized occurrences. By doing this many times, we can estimate the probability distribution for ENM overlap between species under the null hypothesis that the two species’ occurrences in the environment are effectively a random draw from the same underlying distribution. Note that niche evolution is only one of many reasons why two species’ realized environmental distributions might cause departures from this null hypothesis. See Warren et al. 2014 for details.
To run an identity test, we need to decide what type of models we will build, how many replicates we will run, and (in the case of GLM) a model formula to use for empirical models and the Monte Carlo replicates. The resulting object contains the replicate models, p values, and plots of the results. Typically idenity tests are run with at least 99 replicates, but we are using a smaller number here for the sake of execution time.
NOTE: In order for models to be comparable, both empirical and pseudoreplicate models for the identity test are conducted with pseudoabsence points pooled for the two species being compared.
id.glm <- identity.test(species.1 = ahli, species.2 = allogus, env = env, type = "glm", f = presence ~ layer.1 + layer.2 + layer.3 + layer.4, nreps = 4)
id.glm
##
##
##
##
## Identity test ahli vs. allogus
##
## Identity test p-values:
## D I rank.cor env.D env.I env.cor
## 0.2 0.2 0.2 0.2 0.2 0.2
##
##
## Replicates:
##
##
## D I rank.cor env.D env.I env.cor
## ---------- ---------- ---------- ----------- ---------- ---------- -----------
## empirical 0.2419553 0.4885886 -0.3833785 0.0054593 0.0327258 -0.5586399
## rep 1 0.7081601 0.9338666 0.7068333 0.5324061 0.7973097 0.5414232
## rep 2 0.8132703 0.9744684 0.6821181 0.7417985 0.9456546 0.8280152
## rep 3 0.8962881 0.9881074 0.9413461 0.8333784 0.9793519 0.9482602
## rep 4 0.7317980 0.9490732 0.9514236 0.8093458 0.9607815 0.9661764
The background or similarity test compares the overlap seen between two species’ ENMs to the overlap expected by chance if one or both species was effectively choosing habitat at random from within their broad geographic range. The purpose of this test is to correct for the availability of habitat and ask whether the observed similarity between species or populations is significantly more (or less) than expected given the available set of environments in the regions in which they occur.
NOTE: In order for models to be comparable, both empirical and pseudoreplicate models for the background test are conducted with pseudoabsence points pooled for the two species being compared.
In Warren et al. 2008, we developed this test in the context of comparing one species’ actual occurrence to the random background occurrences of the other species. This is what we call an “asymmetric” test, and in our case we did the test in both directions with the idea that we might compare the results of A vs. B background to the results of B vs. A background. This may be informative in some cases, but many people have also found this asymmetry confusing (and indeed it is often difficult to interpret). For that reason, the background test here can be conducted against a null hypothesis that is generated from “asymmetric” (species.1 vs species.2 background) or “symmetric” (species.1 background vs. species.2 background) comparisons.
Here, for instance, is a Bioclim background test using the classical asymmetric approach:
bg.bc.asym <- background.test(species.1 = ahli, species.2 = allogus, env = env, type = "bc", nreps = 4, test.type = "asymmetric" )
bg.bc.asym
##
##
##
##
## Asymmetric background test ahli vs. allogus background
##
## background test p-values:
## D I rank.cor env.D env.I env.cor
## 0.2 0.2 0.2 0.2 0.2 0.2
##
##
## Replicates:
##
##
## D I rank.cor env.D env.I env.cor
## ---------- ---------- ---------- ---------- ---------- ---------- ----------
## empirical 0.1328502 0.3177390 0.0706201 0.0231215 0.1221019 0.0966999
## rep 1 0.1653419 0.3613767 0.2004720 0.0519618 0.2069667 0.1497635
## rep 2 0.1744784 0.3753524 0.2417864 0.0685516 0.2376306 0.1652119
## rep 3 0.1941304 0.3872336 0.2220283 0.0687125 0.2234699 0.1805153
## rep 4 0.1580300 0.3478738 0.1647833 0.0689514 0.1942464 0.1379506
And here is a Domain background test using the symmetric approach:
bg.dm.sym <- background.test(species.1 = ahli, species.2 = allogus, env = env, type = "dm", nreps = 4, test.type = "symmetric" )
bg.dm.sym
##
##
##
##
## Symmetric background test ahli background vs. allogus background
##
## background test p-values:
## D I rank.cor env.D env.I env.cor
## 0.2 0.2 0.2 0.2 0.2 0.2
##
##
## Replicates:
##
##
## D I rank.cor env.D env.I env.cor
## ---------- ---------- ---------- ---------- ---------- ---------- ----------
## empirical 0.4929334 0.7052122 0.2916150 0.1093425 0.3141003 0.2294099
## rep 1 0.9278704 0.9880322 0.7322092 0.3266703 0.5648893 0.4952607
## rep 2 0.7782899 0.9217196 0.5412404 0.2154131 0.4491358 0.4006701
## rep 3 0.9433220 0.9971279 0.5748298 0.8124900 0.9279948 0.8590668
## rep 4 0.8556847 0.9589016 0.4605075 0.2953031 0.5164802 0.3318751
ENMTools also allows you to perform linear, blob, and ribbon rangebreak tests as developed in Glor and Warren 2011. The linear and blob tests are two versions of a test that permit one to ask whether the geographic regions occupied by two species are more environmentally different than expected by chance. The ribbon test, meanwhile, is designed to test whether the ranges of two species are divided by a region that is relatively unsuitable to one or both forms.
For the linear and blob tests, you call them very much like you would the identity and background tests. Here’s a linear one using GLM models:
rbl.glm <- rangebreak.linear(ahli, allogus, env, type = "bc", f = pres ~ layer.1 + layer.2 + layer.3 + layer.4, nreps = 4)
##
## Building empirical models...
##
## Building replicate models...
##
## Replicate 1 ...
##
## Replicate 2 ...
##
## Replicate 3 ...
##
## Replicate 4 ...
rbl.glm
##
##
##
##
## Linear rangebreak test ahli vs. allogus
##
## rangebreak test p-values:
## D I rank.cor env.D env.I env.cor
## 0.8 0.8 0.8 0.2 0.2 0.2
##
##
## Replicates:
##
##
## D I rank.cor env.D env.I env.cor
## ---------- ---------- ---------- ----------- ---------- ---------- ----------
## empirical 0.1328502 0.3177390 0.0706201 0.0216031 0.1127288 0.0856770
## rep 1 0.1983803 0.4107151 0.2916982 0.0520309 0.2107423 0.1495675
## rep 2 0.0327940 0.1544608 -0.0172882 0.2101851 0.3017644 0.2583484
## rep 3 0.1328502 0.3177390 0.0706201 0.0272969 0.1227233 0.0897032
## rep 4 0.1328502 0.3177390 0.0706201 0.0226896 0.1185263 0.0881986
And here’s a blob test using Bioclim:
rbb.bc <- rangebreak.blob(ahli, allogus, env, type = "bc", nreps = 4)
##
## Building empirical models...
##
## Building replicate models...
##
## Replicate 1 ...
##
## Replicate 2 ...
##
## Replicate 3 ...
##
## Replicate 4 ...
rbb.bc
##
##
##
##
## blob rangebreak test ahli vs. allogus
##
## rangebreak test p-values:
## D I rank.cor env.D env.I env.cor
## 0.6 0.6 0.6 0.4 0.4 0.2
##
##
## Replicates:
##
##
## D I rank.cor env.D env.I env.cor
## ---------- ---------- ---------- ---------- ---------- ---------- ----------
## empirical 0.1328502 0.3177390 0.0706201 0.0200055 0.1070401 0.0839870
## rep 1 0.1328502 0.3177390 0.0706201 0.0214084 0.1106674 0.0872531
## rep 2 0.1328502 0.3177390 0.0706201 0.0191564 0.1062490 0.0858561
## rep 3 0.5187961 0.7164635 0.2365479 0.0910430 0.2673128 0.1699476
## rep 4 0.4856474 0.7058445 0.2824758 0.1473192 0.2757570 0.2276616
If you want to access the individual replicates (for instance to see how your ranges are being split up), you can find them in the list named “replicate.models” inside your rangebreak test object.
rbl.glm$replicate.models$ahli.rep.1
##
##
## Data table (top ten lines):
##
## Longitude Latitude
## --- ---------- ---------
## 28 -77.3117 19.9397
## 32 -76.9155 19.9397
## 29 -76.9948 19.9529
## 35 -76.7439 19.9661
## 33 -76.9155 20.0058
## 48 -75.7140 19.9926
## 41 -75.9384 20.0058
## 47 -75.7536 20.0322
## 40 -76.0573 20.0586
## 34 -76.9155 20.1510
##
##
## Model: class : Bioclim
##
## variables: layer.1 layer.2 layer.3 layer.4
##
##
## presence points: 16
## layer.1 layer.2 layer.3 layer.4
## 1 1909 1460 1018 267
## 2 1883 1541 973 289
## 3 2252 1018 1136 237
## 4 2069 1366 1004 279
## 5 2379 893 1197 222
## 6 1850 1596 842 343
## 7 1916 1557 856 360
## 8 1854 1566 828 333
## 9 2234 1255 1034 259
## 10 2050 1573 894 237
## (... ... ...)
##
##
##
## Model fit (training data): class : ModelEvaluation
## n presences : 16
## n absences : 2000
## AUC : 0.924125
## cor : 0.1961205
## max TPR+TNR at : 0.0624
##
##
## Proportion of data wittheld for model fitting: 0
##
## Model fit (test data): [1] NA
##
##
## Suitability:
## class : RasterLayer
## dimensions : 418, 1535, 641630 (nrow, ncol, ncell)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -86.90809, -74.11642, 19.80837, 23.2917 (xmin, xmax, ymin, ymax)
## coord. ref. : NA
## data source : in memory
## names : layer
## values : 0, 0.875 (min, max)
rbl.glm$replicate.models$allogus.rep.1
##
##
## Data table (top ten lines):
##
## Longitude Latitude
## --- ---------- ---------
## 55 -75.1198 20.1114
## 60 -74.9745 20.1114
## 36 -76.5590 20.2038
## 31 -76.9288 20.2434
## 57 -75.0273 20.1510
## 76 -74.2747 20.1114
## 70 -74.6180 20.1378
## 66 -74.7897 20.1510
## 74 -74.3803 20.1378
## 37 -76.5326 20.2963
##
##
## Model: class : Bioclim
##
## variables: layer.1 layer.2 layer.3 layer.4
##
##
## presence points: 65
## layer.1 layer.2 layer.3 layer.4
## 1 1748 1782 957 332
## 2 2018 1467 1012 355
## 3 2150 1443 972 241
## 4 2085 1646 809 223
## 5 2022 1563 972 330
## 6 1972 1243 1112 422
## 7 2173 1157 1082 452
## 8 2178 1302 975 464
## 9 2060 1291 918 503
## 10 2107 1601 947 257
## (... ... ...)
##
##
##
## Model fit (training data): class : ModelEvaluation
## n presences : 65
## n absences : 3000
## AUC : 0.4783615
## cor : -0.01037478
## max TPR+TNR at : 0.01457692
##
##
## Proportion of data wittheld for model fitting: 0
##
## Model fit (test data): [1] NA
##
##
## Suitability:
## class : RasterLayer
## dimensions : 418, 1535, 641630 (nrow, ncol, ncell)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -86.90809, -74.11642, 19.80837, 23.2917 (xmin, xmax, ymin, ymax)
## coord. ref. : NA
## data source : in memory
## names : layer
## values : 0, 0.8923077 (min, max)
For the ribbon rangebreak test, you will need one extra thing; a third enmtools.species object representing the occurrence points (for one or both species) that fall within the ribbon of putatively unsuitable habitat. In the case of these two anoles we don’t have such a ribbon, so we’ll just simulate one based on some random points.
ribbon <- enmtools.species(species.name = "ribbon")
ribbon$presence.points <- data.frame(Longitude = runif(n = 10, min = -79, max = -78.5),
Latitude = runif(n = 10, min = 21.7, max = 22.1))
plot(env[[1]])
points(ribbon$presence.points, pch = 16)
ribbon$range <- background.raster.buffer(ribbon$presence.points, 20000, mask = env)
ribbon
##
##
## Range raster:
## class : RasterLayer
## dimensions : 418, 1535, 641630 (nrow, ncol, ncell)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -86.90809, -74.11642, 19.80837, 23.2917 (xmin, xmax, ymin, ymax)
## coord. ref. : NA
## data source : in memory
## names : layer.1
## values : 1, 1 (min, max)
##
##
##
## Presence points (first ten only):
##
## Longitude Latitude
## ---------- ---------
## -78.54103 22.01020
## -78.53243 21.96610
## -78.54106 22.06002
## -78.72369 22.07742
## -78.68904 21.71779
## -78.82367 21.91590
## -78.54517 21.73259
## -78.71125 21.79796
## -78.90742 21.91180
## -78.85463 21.81913
##
##
## Background points not defined.
##
## Species name: ribbon
Now we’ll run a ribbon rangebreak test using GLM models. We also need to tell it the width of the ribbons to generate for the replicates. The units for the width argument are the same units that the presence points are in; e.g., if the points are in decimal degrees you should supply the width of the barrier in decimal degrees.
rbr.glm <- rangebreak.ribbon(ahli, allogus, ribbon, env, type = "glm", f = pres ~ layer.1 + layer.2 + layer.3 + layer.4, width = 0.5, nreps = 4)
##
##
## No background points provided, drawing background from range raster.
## Warning in couldBeLonLat(mask): CRS is NA. Assuming it is longitude/
## latitude
##
## Building empirical models...
## Adding environmental data to species ahli
## Processing presence points...
## Processing background points...
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## Adding environmental data to species allogus
## Processing presence points...
## Processing background points...
## Adding environmental data to species ribbon
## Processing presence points...
## Processing background points...
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## Adding environmental data to species outside
## Processing presence points...
## Processing background points...
##
## Building replicate models...
##
## Replicate 1 ...
##
## Replicate 1 ...
## Adding environmental data to species ahli
## Processing presence points...
## Processing background points...
## Adding environmental data to species allogus
## Processing presence points...
## Processing background points...
## Adding environmental data to species ribbon
## Processing presence points...
## Processing background points...
## Adding environmental data to species outside
## Processing presence points...
## Processing background points...
##
## Replicate 2 ...
## Adding environmental data to species ahli
## Processing presence points...
## Processing background points...
## Adding environmental data to species allogus
## Processing presence points...
## Processing background points...
## Adding environmental data to species ribbon
## Processing presence points...
## Processing background points...
## Adding environmental data to species outside
## Processing presence points...
## Processing background points...
##
## Replicate 3 ...
## Adding environmental data to species ahli
## Processing presence points...
## Processing background points...
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## Adding environmental data to species allogus
## Processing presence points...
## Processing background points...
## Adding environmental data to species ribbon
## Processing presence points...
## Processing background points...
## Adding environmental data to species outside
## Processing presence points...
## Processing background points...
##
## Replicate 4 ...
## Adding environmental data to species ahli
## Processing presence points...
## Processing background points...
## Adding environmental data to species allogus
## Processing presence points...
## Processing background points...
## Adding environmental data to species ribbon
## Processing presence points...
## Processing background points...
## Adding environmental data to species outside
## Processing presence points...
## Processing background points...
rbr.glm
##
##
##
##
## ribbon rangebreak test ahli vs. allogus
##
## rangebreak test p-values...
##
## Species 1 vs. Species 2:
## D I rank.cor env.D env.I env.cor
## 0.4 0.4 0.8 0.4 0.4 0.8
##
## Species 1 vs. Ribbon:
## D I rank.cor env.D env.I env.cor
## 0.6 0.4 0.6 0.8 0.8 1.0
##
## Species 2 vs. Ribbon:
## D I rank.cor env.D env.I env.cor
## 0.2 0.2 0.2 0.2 0.2 0.2
##
## Outside vs. Ribbon:
## D I rank.cor env.D env.I env.cor
## 0.2 0.2 0.2 0.2 0.2 0.2
##
##
## Replicates:
##
## Species 1 vs. Species 2:
## D I rank.cor env.D env.I
## empirical 0.21690043 0.4514724 -0.1616728 0.010123597 0.04003425
## rep 1 0.40655744 0.6997530 -0.5662192 0.041782018 0.12610098
## rep 2 0.39173774 0.6858501 -0.5831605 0.041125834 0.12517983
## rep 3 0.25423102 0.5074273 -0.4538528 0.006933494 0.03318055
## rep 4 0.08952479 0.2889652 0.5613097 0.509628770 0.75722484
## env.cor
## empirical -0.3588137
## rep 1 -0.6081901
## rep 2 -0.5896482
## rep 3 -0.6211014
## rep 4 0.4939712
##
## Species 1 vs. Ribbon:
## D I rank.cor env.D env.I
## empirical 0.30009692 0.49984332 0.3503599 0.091808057 0.18568787
## rep 1 0.33592723 0.61929647 0.2721797 0.009676791 0.04938608
## rep 2 0.29618172 0.57918993 0.4233006 0.017503800 0.06918073
## rep 3 0.37198411 0.67334512 0.3629407 0.009408434 0.03785908
## rep 4 0.01272613 0.08735658 0.2615795 0.169528469 0.35687167
## env.cor
## empirical 0.22306493
## rep 1 -0.35279242
## rep 2 -0.21204093
## rep 3 0.10352273
## rep 4 0.08606169
##
## Species 2 vs. Ribbon:
## D I rank.cor env.D env.I
## empirical 0.08015885 0.2190728 -0.8569216 0.01373025 0.07308956
## rep 1 0.23513882 0.5071494 -0.1975075 0.15652103 0.33187610
## rep 2 0.16671865 0.3950559 -0.3603427 0.14173115 0.30091555
## rep 3 0.50556121 0.8148613 0.5510305 0.40958531 0.67294176
## rep 4 0.44635007 0.7567568 0.8794770 0.47878513 0.73733088
## env.cor
## empirical -0.592291959
## rep 1 0.007950003
## rep 2 -0.104162788
## rep 3 0.527722279
## rep 4 0.860015538
##
## Outside vs. Ribbon:
## D I rank.cor env.D env.I env.cor
## empirical 0.1092493 0.2707467 -0.8603005 0.0154075 0.08861264 -0.6552440
## rep 1 0.2644591 0.5419874 -0.2655104 0.1388235 0.32203019 -0.1377303
## rep 2 0.1995637 0.4446369 -0.4108058 0.1330490 0.30932184 -0.2138617
## rep 3 0.5284023 0.8353749 0.5765003 0.3866593 0.66643032 0.5126974
## rep 4 0.3988343 0.6948171 0.5557446 0.2567209 0.52435663 0.4340341
Note that the output table here has slope, intercept, and intercept offset.
rbr.glm$lines.df
## slope intercept offset
## 1 0.3943353 51.66975 0.2687355
## 2 0.2438966 39.98626 0.2573283
## 3 -1.9294555 -128.48843 0.5433000
## 4 -4.5547469 -327.95546 1.1658076
The intercept denotes the intercept corresponding to the CENTER of each ribbon. To get the lines denoting the edges of the ribbons (for example if you want to plot the ribbons on a map), you add and substract the offset. In other words, the top edge of the ribbon is given by y = (slope * x) + intercept + offset, while the bottom edge is given by y = (slope * x) + intercept - offset.
Levins, R. 1968. Evolution In Changing Environments. Monographs in Population Biology, volume 2. Princeton University Press, Princeton, New Jersey, USA.
Schoener, T. W. 1968. Anolis lizards of Bimini: resource partitioning in a complex fauna. Ecology 49:704- 726.
Warren, D.L., R.E. Glor, and M. Turelli. 2008. Environmental niche identity versus conservatism: quantitative approaches to niche evolution. Evolution 62:2868-2883. doi: 10.1111/j.1558-5646.2008.00482.x
Warren, D.L., M. Cardillo, D.F. Rosauer, and D.I. Bolnick. 2014. Mistaking geography for biology: inferring processes from species distributions. Trends in Ecology and Evolution 29 (10), 572-580. doi: 10.1016/j.tree.2014.08.003